package com.fu.jdbc2;

import com.mysql.jdbc.JDBC4Connection;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
import java.util.Properties;

/**
 * @author 付大大
 * @description
 * @create 2021-01-31 12:31
 */
public class Myconnection extends JDBC4Connection {

    private Connection connection;
    private List<Connection> pool;


    public Myconnection(String hostToConnectTo, int portToConnectTo, Properties info, String databaseToConnectTo, String url, Connection connection, List<Connection> pool) throws SQLException {
        super(hostToConnectTo, portToConnectTo, info, databaseToConnectTo, url);
        this.connection = connection;
        this.pool = pool;
    }


    @Override
    public void close() throws SQLException {
        pool.add(connection);
    }
}
